//./single 16 32 2 5
#include "config.h"
#include "cache.h"
#include "parser.h"
#include "queue.h"
#include <fstream>
#include <assert.h>

unsigned long cur_cyc = 0;

int main(int argc, char* argv[]) {
  int size = atoi(argv[1]);
  int block_size = atoi(argv[2]);
  int way = atoi(argv[3]);
  int hit_latency = atoi(argv[4]);
  multi_test = 0;

  // create modules in the simulator
  L1Cache cache(size, block_size, hit_latency, way, 0);
  Memory mem(1, 0, 99);
  Parser parser(argv[5], 0);

  // connect modules in the simulator
  mem.SetL2(0, cache.Q);
  cache.SetL2(mem.Q);
  parser.SetL1(cache.Q);

  while(!parser.QEmpty()||!cache.QEmpty()||!mem.QEmpty()) {
    mem.Update();
    cache.Update();
    parser.Update();
    cur_cyc++;
  }
  cout<<"current cycle: "<<cur_cyc<<endl;
  cache.PrintStats();

  return 0;
}
